<!DOCTYPE html>
<html>
<head>
<base href="${basePath}">
<meta charset="UTF-8">
<title>会员统计</title> $!{include("import_js_css.html")}
$!{include("header.html")}
<link draggable="true" rel="stylesheet"
	href="${viewPath}/resources/css/statistics.css" />
<link rel="stylesheet" type="text/css" href="${viewPath}/resources/css/expression.css" />
<link draggable="true" rel="stylesheet"
	href="${assetsPath}/js/jquery/ui/jquery-ui.min.css" />
<script type="text/javascript"
	src="${assetsPath}/js/jquery/ui/jquery-ui.min.js"></script>
<script type="text/javascript">
	$(function() {
		$(".drag_all .drag-item").draggable({
			cursor : "move",
			revert : true
		});

		$(".drag-to").droppable({
			accept : ".drag-item",
			drop : function(event, ui) {
				var dragToItem = ui.helper;
				$(this).append(dragToItem);
			}
		});

		$(".drag_all").droppable({
			accept : ".drag-item",
			drop : function(event, ui) {
				var dragToItem = ui.helper;
				$(this).append(dragToItem);
			}
		});
		//--初始化树
		loadzTree("qbcMember");
		$("#stat_info li a").click(function(){
			if(!$(this).parent().hasClass('active')){
				$("#stat_list table thead").remove();
				$("#stat_list table tbody").remove();
			}
		});
		$(".btn-group-sm .btn-default").click(function() {
			var val = $(this).attr("id");
			$(".btn-group button").each(function() {
				if ($(this).attr("id") == val) {
					$(this).addClass("active");
				} else {
					$(this).removeClass("active");
				}
			});
		});
		
		
	//------------------------tree info start------------------------//	
	//------------------------
		$("#stat_info li").click(function(){
			loadzTree($(this).attr("id"));
			$("tr[id^=ds_tr_]").remove();
		});	
	
	//下拉列表框
		$("#resporId").select2({
			width: "100px",
			minimumResultsForSearch: -1
		});
	
		$("#selmemberStatElement").select2({
			width: "90px",
			minimumResultsForSearch: -1
		});
	
		$("#groupName").val("");
		$("#expression").val("");
		$("#expressionType").val("");
		$("#resporId").select2("val", "");
		$("#proName").val("");
		
		$("#tb_stratety").html("<tr><td style='width: 30px;'><input name='ds_selectAll' type='checkbox'></td><td style='width: 60px;'>序号</td><td>表达式</td></tr>");
		
		var count = $("input[name^='ds_name_']").length;
		
		var t = $("#tree");
		t = $.fn.zTree.init(t, setting, zNodes);
		
		$("#shu").find('div span').click(function(){
			var id = $(this).attr("id");
			id = id.substring(16, id.length);
			var con = $(this).text();
			var val = $("#hidden_expression_" + id).val();
			$("#groupName").val(con);
			$("#expression").val(val);
		});
		
		//点击生成表达式
		$("#btn_member_export").click(function(){
			//获得选择的条件名称
			var shuconn = $("#groupName").val().trim();
			//获得大于小于选择框的显示文字
			var selectconn = $("#resporId").find("option:selected").text().trim();
			//获得大于小于选择框符号
			var selectVal = $("#resporId").select2("val");
			//获得输入框的值
			var proconn = $("#proName").val().trim();
			//获得表达式的字段部分
			var expression = $("#expression").val().trim().replace(/[&\|\\\*^%$#@\-]/g,"");

			//条件不能为空
			if (expression == null || expression.length <= 0) {
				alert("请选择一个条件!")
				return;
			}
			
			//符号不能为空
			if (selectconn == null || selectconn.length <= 0) {
				alert("请选择一个比较符号!");
				return;
			}
			
			//组合表达式显示文字
			var bigconn = shuconn + selectconn + proconn;
			//组合表达式值
			var bigVal = expression + " " + selectVal + " " + proconn;
			
			//判断选择是否为空
			if (selectVal == "is null" || selectVal == "is not null") {
				bigconn = shuconn + selectconn;
				bigVal = expression + " " + selectVal;
			}
			else if (selectVal == "like") {
				//判断类型
				var type = $("#expressionType").val();
				if(type=="VARCHAR"){
					bigconn = shuconn + selectconn + "\"" + proconn + "\"";
				}else{
					bigconn = shuconn + selectconn + proconn;
				}
				proconn = "\"%" + proconn + "%\"";
				bigVal = expression + " " + selectVal + proconn;
			} else {
				if (proconn == null || proconn.length <= 0) {
					alert("请输入比较字符串!");
					return;
				}
				
				//判断类型
				var type = $("#expressionType").val();
				if (type == "int") {
					proconn = proconn * 1;
				} else if (type == "VARCHAR") {
					proconn = "\"" + proconn + "\"";
				} else {
					proconn = proconn;
				}
				
				bigconn = shuconn + selectconn + proconn;
				bigVal = expression + " " + selectVal + " " + proconn;
			}
			
			count ++;
			$("#tb_stratety").append(
				"<tr id='ds_tr_" + count + "'>" + 
				"<td><input name='ds_name_" + count + "' type='checkbox'></td>" + 
				"<td><span>" + count + "<span></td>" + 
				"<td id='ds_td_" + count + "'><span>" + bigconn + "</span><p id='ds_condition_" + count + "'>" + bigVal + "</p></td>" + 
				"</tr>"
			);
		});
		
		//全选
		$("input[name='ds_selectAll']").click(function() {
			$("input[name^='ds_name_']").prop("checked", $(this).prop("checked"));
		});

		//同时满足
		$("#ds_fit_meanwhile").click(function() {
			var len = $("input[name^='ds_name_']:checked").length;
			if (len < 1) {
				alert("请选择一个表达式!");
				return;
			} else if (len == 1) {
				alert("请选择另一个表达式!");
				return;
			}
			var selDS = new Array();
			
			//记录选中的序号
			var stgText = new Array();
			$("input[name^='ds_name_']:checked").each(function() {
				var name = $(this).attr("name");
				var index = name.substring(8, name.length);
				//var text = $("#ds_td_" + index + " span").text().trim();
				stgText.push("满足条件" + index);
				//拼接表达式
				var strategy = $("p[id='ds_condition_" + index + "']").text();
				selDS.push("(" + strategy + ")");
			});
			var strategies = selDS.join(" && ");
			
			var text = stgText.join(" 且 ");
			count ++;
			$("#tb_stratety").append(
				"<tr id='ds_tr_" + count + "'>" + 
				"<td><input name='ds_name_" + count + "' type='checkbox'></td>" + 
				"<td><span>" + count + "<span></td>" + 
				"<td id='ds_td_" + count + "'><span>" + text + "</span><p id='ds_condition_" + count + "'>" + strategies + "</p></td>" + 
				"</tr>"
			);
		});
		
		//满足其一
		$("#ds_fit_oneMore").click(function() {
			var len = $("input[name^='ds_name_']:checked").length;
			if (len < 1) {
				alert("请选择一个表达式!");
				return;
			} else if (len == 1) {
				alert("请选择另一个表达式!");
				return;
			}
			var selDS = new Array();
			
			//记录选中的序号
			var stgText = new Array();
			$("input[name^='ds_name_']:checked").each(function() {
				var name = $(this).attr("name");
				var index = name.substring(8, name.length);
				stgText.push("满足条件" + index);
				
				//拼接表达式
				var strategy = $("p[id='ds_condition_" + index + "']").text();
				selDS.push("(" + strategy + ")");
			});
			var strategies = selDS.join(" || ");
			
			var text = stgText.join(" 或 ");
			count ++;
			$("#tb_stratety").append(
				"<tr id='ds_tr_" + count + "'>" + 
				"<td><input name='ds_name_" + count + "' type='checkbox'></td>" + 
				"<td><span>" + count + "<span></td>" + 
				"<td id='ds_td_" + count + "'><span>" + text + "</span><p id='ds_condition_" + count + "'>" + strategies + "</p></td>" + 
				"</tr>"
			);
		});
		
		//满足相反
		$("#ds_fit_contrary").click(function() {
			var len = $("input[name^='ds_name_']:checked").length;
			if (len < 1) {
				alert("请选择一个表达式!");
				return;
			} else if (len > 1) {
				alert("只可选择一个!");
				return;
			}
			var selDS = new Array();
			
			var stgText = new Array();
			$("input[name^='ds_name_']:checked").each(function() {
				//记录选中的序号
				var name = $(this).attr("name");
				var index = name.substring(8, name.length);
				stgText.push("不满足条件" + index);
				
				//拼接表达式
				var strategy = $("p[id='ds_condition_" + index + "']").text();
				selDS.push("!(" + strategy + ")");
			});
			
			var strategies = selDS.join(" && ");
			
			var text = stgText.join(" ");
			count ++;
			$("#tb_stratety").append(
				"<tr id='ds_tr_" + count + "'>" + 
				"<td><input name='ds_name_" + count + "' type='checkbox'></td>" + 
				"<td><span>" + count + "<span></td>" + 
				"<td id='ds_td_" + count + "'><span>" + text + "</span><p id='ds_condition_" + count + "'>" + strategies + "</p></td>" + 
				"</tr>"
			);
		});
		
		//删除
		$("#ds_fit_delete").click(function() {
			var len = $("input[name^='ds_name_']:checked").length;
			if (len < 1) {
				alert("请选择一个表达式!");
				return;
			}
			
			confirm("确定删除?", function() {
				$("input[name^='ds_name_']:checked").each(function() {
					var name = $(this).attr("name");
					var index = name.substring(8, name.length);
					
					//移除选择的tr
					$("#ds_tr_" + index).remove();
				});
				
				//全选按钮重置
				$("input[name='ds_selectAll']").prop("checked", false);
			});			
		});
		
		//点击查询按钮
		$("#ds_fit_search").click(function() {
			var xm = $("#stat_info .active a").attr("href");
			var m = xm.split('-')[1];
			commonStatInfo(m);
		});
		
		$("#a_shqc").click(function(){
			$("#stat_cdts").slideToggle('fast');
			var txt = $(this).text();
			if(txt=='>>'){
				$(this).attr('title','条件显示');
				$(this).text("<<");
			}else{
				$(this).attr('title','条件隐藏');
				$(this).text(">>");
			}
		});
	//------------------------tree info end--------------------------//	
	});
	
	function loadzTree(type){
		console.log(type);
		var url = "${basePath}/yueyogaAdmin/ajaxFindTreeByType.jhtml";
		$.post(url,{"type": type},
			function(response) {
				var res = eval("(" + response + ")");
				if (res.success) {
					var node = res.items;
					var setting = {
							view: {
								dblClickExpand: false,
								showLine: true,
								selectedMulti: false,
					},data :{key : {
								name:"text",
								children:"childNodes",
								url:"link"
							}
						},
					 callback: {
						onClick: zTreeOnClick
					} 
				};
				var t = $("#tree");
				t = $.fn.zTree.init(t, setting, node);
			} else {
					alert(res.msg);
			}
		});
	}
	//--信息统计
	function commonStatInfo(model) {
		//--统计类别
		var stat_fun = $("#drag_"+model+"_cdts .btn-group-sm .active").attr("data");
		if(!stat_fun){
			var d = alert("请选择统计方式!");
			setTimeout(function(){
				d.close().remove();
			},3000);
			return;
		}
		//--统计元素
		var stat_col = $("#sel"+model+"StatElement").val();
		
		var lt_group = "";
		var tp_group = "";
		//--左侧分组条件
		var ltGroup = $("#drag_"+model+"_lt .drag_left").children();
		var toGroup = $("#drag_"+model+"_lt .drag_top").children();
		
		//--左侧分组条件
		$("#drag_"+model+"_lt .drag_left .drag-item div").each(function(){
			lt_group+= $(this).attr("data") + ",";
		});
		
		//--右侧分组条件，对应统计列表中的头部分组条件
		$("#drag_"+model+"_lt .drag_top .drag-item div").each(function(){
			tp_group+= $(this).attr("data") + ",";
		});
		
		
		//--条件表达式----/
		var len = $("input[name^='ds_name_']:checked").length;
		
		var exp = "";
		$("input[name^='ds_name_']:checked").each(function() {
			//记录选中的序号
			var name = $(this).attr("name");
			var index = name.substring(8, name.length);
			//获得表达式
			exp = $("#ds_condition_" + index).text();
		});
		
		var url = "yueyogaAdmin/"+model+"Statistics.jhtml";
		$("#stat_list table thead").remove();
		$("#stat_list table tbody").remove();
		$.post(url,
			{ltGroup:lt_group,tpGroup:tp_group,statFun:stat_fun,statCol:stat_col,criteria:exp}
			,function(resp){
				if(!resp){
					$("#stat_list table").append("<tr><td colspan='15'>查询结果为空</td><tr>");
					return;
				}
				var data = eval("("+resp+")");
				var headerTrs = data.header;
				var bodyTrs = data.body;
				var len = headerTrs.length + bodyTrs.length - 1 ;
				
				var tb = "<thead>";
				
				$.each(headerTrs, function(tr, htr) { 
					var htds = htr.tds;
					tb +="<tr>";
					$.each(htds,function(td,htd){
						tb +="<th style='text-align:center;' colspan='"+htd.colspan+"' rowspan='"+htd.rowspan+"' data='"+htd.id+"'>" + htd.text + "</th>";
					});
					tb +="</tr>";
				}); 
				tb +="</thead>";
				$("#stat_list table").append(tb);
				
				//--tbody
				tb = "<tbody>";
				$.each(bodyTrs, function(tr, btr) { 
					var btds = btr.tds;
					tb +="<tr>";
					$.each(btds,function(td,btd){
						tb +="<td colspan='"+btd.colspan+"' rowspan='"+btd.rowspan+"' data='"+btd.id+"'>" + btd.text + "</td>";
					});
					tb +="</tr>";
				});
				tb +="</tbody>";
				$("#stat_list table").append(tb);
				$("#stat_list table thead tr:first-child th:first-child").text("分组条件");
		});
	}
	//--获取数据
	function getTreeData(model) {
		var model = "member";
		var len = $("input[name^='ds_name_']:checked").length;
		if (len != 1) {
			alert("请选择一个表达式!");
			return;
		}
		var exp = "";
		$("input[name^='ds_name_']:checked").each(function() {
			//记录选中的序号
			var name = $(this).attr("name");
			var index = name.substring(8, name.length);
			//获得表达式
			exp = $("#ds_condition_" + index).text();
		});
		alert(exp);
	}

function hidePanel(){
	$("#span12").hide();
}
</script>
</head>
<body style="background-color: #fff;">
	<div id="drag_container" class="container menu_all">
		<div class="row-fluid drag-ctr-info panel-radius-stat">
			<div class="span12">
				<div class="tabbable">
					<ul id="stat_info" class="nav nav-tabs">
						<li id="qbcMember" class="active"><a href="#panel-member" data-toggle="tab">会员</a></li>
						<li id="qbcClazz"><a href="#panel-clazz" data-toggle="tab">班级</a></li>
						<li id="qbcLiftClub"><a href="#panel-liftClub" data-toggle="tab">活动</a></li>
						<li id="qbcProduct"><a href="#panel-product" data-toggle="tab">产品</a></li>
						<li id="qbcGoods"><a href="#panel-goods" data-toggle="tab">商品</a></li>
						<li id="qbcTask"><a href="#panel-task" data-toggle="tab">任务</a></li>
					</ul>
					<div class="tab-content">
						<div class="tab-pane active" id="panel-member">
							<div>
								<div class="drag_all panel-radius-stat ui-widget-content">
									<div class="drag-item">
										<div data="consumeType">消费类型</div>
									</div>
									<div class="drag-item">
										<div data="sex">性别</div>
									</div>
									<div class="drag-item">
										<div data="birthday">年龄段</div>
									</div>
									<div class="drag-item">
										<div data="marketingSource">信息来源</div>
									</div>
									<div class="drag-item">
										<div data="status">状态</div>
									</div>
									<div class="drag-item">
										<div data="subStatus">子状态</div>
									</div>
									<div class="drag-item">
										<div data="marketingChannel">渠道</div>
									</div>
									<div class="drag-item">
										<div data="subMarketingChannel">子渠道</div>
									</div>
									
									<div class="drag-item">
										<div data="provinceId">所在省</div>
									</div>
									<div class="drag-item">
										<div data="cityId">所在市</div>
									</div>
									<div class="drag-item">
										<div data="areaId">所在区</div>
									</div>
									<div class="drag-item">
										<div data="domainId">所在域</div>
									</div>
									<div class="drag-item">
										<div data="clazz">班级</div>
									</div>
									<div class="drag-item">
										<div data="liftClub">活动</div>
									</div>
								</div>
							</div>
							<div id="drag_member_lt" class="clear drag_group_lt">
								<div class="drag_left drag-to span12 panel-radius-stat"></div>
								<div class="drag_top drag-to span12 panel-radius-stat"></div>
							</div>
							<div id="drag_member_cdts" class="drag-member-cdts">
								<div id="drag_function" class="btn-group btn-group-sm btn-gp-default">
									<button id="btn_avg" type="button" data="avg"
										class="btn btn-default panel-radius-left">平均</button>
									<button id="btn_max" type="button" data="max"
										class="btn btn-default panel-radius-none">最大</button>
									<button id="btn_min" type="button" data="min"
										class="btn btn-default panel-radius-none">最小</button>
									<button id="btn_total" type="button" data="sum"
										class="btn btn-default panel-radius-none">总和</button>
									<button id="btn_count" type="button" data="count"
										class="btn btn-default panel-radius-right active">数量</button>
								</div>
								<div class="stat-element">
									<select id="selmemberStatElement" class="selectpicker show-tick">
										<option value="id">会员</option>
										<option value="remaining">金额</option>
										<option value="score">积分</option>
									</select>
								</div>
								<div class="stat-btn-search">
									<button id="btn_member_search" type="button"
										onclick="commonStatInfo('member')" class="btn btn-ade-default">查询</button>
								</div>
							</div>
						</div>
						
						<!-- 班级 Tab -->
						<div class="tab-pane" id="panel-clazz">
							<div>
								<div class="drag_all panel-radius-stat ui-widget-content">
									<div class="drag-item">
										<div data="type">类型</div>
									</div>
									<div class="drag-item">
										<div data="state">状态</div>
									</div>
								</div>
							</div>
							<div  id="drag_clazz_lt" class="clear drag_group_lt">
								<div class="drag_left drag-to span12 panel-radius-stat"></div>
								<div class="drag_top drag-to span12 panel-radius-stat"></div>
							</div>
							<div id="drag_clazz_cdts" class="drag-member-cdts">
								<div class="btn-group btn-group-sm btn-gp-default">
									<button id="btn_avg" type="button" data="avg"
										class="btn btn-default panel-radius-left">平均</button>
									<button id="btn_max" type="button" data="max"
										class="btn btn-default panel-radius-none">最大</button>
									<button id="btn_min" type="button" data="min"
										class="btn btn-default panel-radius-none">最小</button>
									<button id="btn_total" type="button" data="sum"
										class="btn btn-default panel-radius-none">总和</button>
									<button id="btn_count" type="button" data="count"
										class="btn btn-default panel-radius-right active">数量</button>
								</div>
								<div class="stat-element">
									<select id="selclazzStatElement" class="selectpicker show-tick"
										data-width="130px">
										<option value="id">班级</option>
									</select>
								</div>
								<div class="stat-btn-search">
									<button id="btn_member_search" type="button"
										onclick="commonStatInfo('clazz')" class="btn btn-ade-default">查询</button>
								</div>
							</div>
						</div>
						
						<!-- 活动 Tab -->
						<div class="tab-pane" id="panel-liftClub">
							<div>
								<div class="drag_all panel-radius-stat ui-widget-content">
									<div class="drag-item">
										<div data="coachType0Id">老师</div>
									</div>
									<div class="drag-item">
										<div data="coachType1Id">助教</div>
									</div>
									<div class="drag-item">
										<div data="placeId">场地</div>
									</div>
								</div>
							</div>
							<div  id="drag_liftClub_lt" class="clear drag_group_lt">
								<div class="drag_left drag-to span12 panel-radius-stat"></div>
								<div class="drag_top drag-to span12 panel-radius-stat"></div>
							</div>
							<div id="drag_liftClub_cdts" class="drag-member-cdts">
								<div class="btn-group btn-group-sm btn-gp-default">
									<button id="btn_avg" type="button" data="avg"
										class="btn btn-default panel-radius-left">平均</button>
									<button id="btn_max" type="button" data="max"
										class="btn btn-default panel-radius-none">最大</button>
									<button id="btn_min" type="button" data="min"
										class="btn btn-default panel-radius-none">最小</button>
									<button id="btn_total" type="button" data="sum"
										class="btn btn-default panel-radius-none">总和</button>
									<button id="btn_count" type="button" data="count"
										class="btn btn-default panel-radius-right active">数量</button>
								</div>
								<div class="stat-element">
									<select id="selliftClubStatElement" class="selectpicker show-tick"
										data-width="130px">
										<option value="id">活动</option>
									</select>
								</div>
								<div class="stat-btn-search">
									<button id="btn_member_search" type="button"
										onclick="commonStatInfo('liftClub')" class="btn btn-ade-default">查询</button>
								</div>
							</div>
						</div>
						
						<!-- 产品 Tab -->
						<div class="tab-pane" id="panel-product">
							<div>
								<div class="drag_all panel-radius-stat ui-widget-content">
									<div class="drag-item">
										<div data="type">类型</div>
									</div>
									<div class="drag-item">
										<div data="price">价格区间</div>
									</div>
								</div>
							</div>
							<div  id="drag_product_lt" class="clear drag_group_lt">
								<div class="drag_left drag-to span12 panel-radius-stat"></div>
								<div class="drag_top drag-to span12 panel-radius-stat"></div>
							</div>
							<div id="drag_product_cdts" class="drag-member-cdts">
								<div class="btn-group btn-group-sm btn-gp-default">
									<button id="btn_avg" type="button" data="avg"
										class="btn btn-default panel-radius-left">平均</button>
									<button id="btn_max" type="button" data="max"
										class="btn btn-default panel-radius-none">最大</button>
									<button id="btn_min" type="button" data="min"
										class="btn btn-default panel-radius-none">最小</button>
									<button id="btn_total" type="button" data="sum"
										class="btn btn-default panel-radius-none">总和</button>
									<button id="btn_count" type="button" data="count"
										class="btn btn-default panel-radius-right active">数量</button>
								</div>
								<div class="stat-element">
									<select id="selproductStatElement" class="selectpicker show-tick"
										data-width="130px">
										<option value="id">产品</option>
									</select>
								</div>
								<div class="stat-btn-search">
									<button id="btn_member_search" type="button"
										onclick="commonStatInfo('product')" class="btn btn-ade-default">查询</button>
								</div>
							</div>
						</div>
						
						<!-- 商品 Tab -->
						<div class="tab-pane" id="panel-goods">
							<div>
								<div class="drag_all panel-radius-stat ui-widget-content">
									<div class="drag-item">
										<div data="type">类型</div>
									</div>
									<div class="drag-item">
										<div data="price">价格区间</div>
									</div>
								</div>
							</div>
							<div  id="drag_goods_lt" class="clear drag_group_lt">
								<div class="drag_left drag-to span12 panel-radius-stat"></div>
								<div class="drag_top drag-to span12 panel-radius-stat"></div>
							</div>
							<div id="drag_goods_cdts" class="drag-member-cdts">
								<div class="btn-group btn-group-sm btn-gp-default">
									<button id="btn_avg" type="button" data="avg"
										class="btn btn-default panel-radius-left">平均</button>
									<button id="btn_max" type="button" data="max"
										class="btn btn-default panel-radius-none">最大</button>
									<button id="btn_min" type="button" data="min"
										class="btn btn-default panel-radius-none">最小</button>
									<button id="btn_total" type="button" data="sum"
										class="btn btn-default panel-radius-none">总和</button>
									<button id="btn_count" type="button" data="count"
										class="btn btn-default panel-radius-right active">数量</button>
								</div>
								<div class="stat-element">
									<select id="selgoodsStatElement" class="selectpicker show-tick"
										data-width="130px">
										<option value="id">商品</option>
									</select>
								</div>
								<div class="stat-btn-search">
									<button id="btn_goods_search" type="button"
										onclick="commonStatInfo('goods')" class="btn btn-ade-default">查询</button>
								</div>
							</div>
						</div>
						
						<!-- 任务 Tab -->
						<div class="tab-pane" id="panel-task">
							<div>
								<div class="drag_all panel-radius-stat ui-widget-content">
									<div class="drag-item">
										<div data="subStatusId">工作安排</div>
									</div>
									<div class="drag-item">
										<div data="state">状态</div>
									</div>
								</div>
							</div>
							<div  id="drag_task_lt" class="clear drag_group_lt">
								<div class="drag_left drag-to span12 panel-radius-stat"></div>
								<div class="drag_top drag-to span12 panel-radius-stat"></div>
							</div>
							<div id="drag_task_cdts" class="drag-member-cdts">
								<div class="btn-group btn-group-sm btn-gp-default">
									<button id="btn_avg" type="button" data="avg"
										class="btn btn-default panel-radius-left">平均</button>
									<button id="btn_max" type="button" data="max"
										class="btn btn-default panel-radius-none">最大</button>
									<button id="btn_min" type="button" data="min"
										class="btn btn-default panel-radius-none">最小</button>
									<button id="btn_total" type="button" data="sum"
										class="btn btn-default panel-radius-none">总和</button>
									<button id="btn_count" type="button" data="count"
										class="btn btn-default panel-radius-right active">数量</button>
								</div>
								<div class="stat-element">
									<select id="seltaskStatElement" class="selectpicker show-tick"
										data-width="130px">
										<option value="id">任务</option>
									</select>
								</div>
								<div class="stat-btn-search">
									<button id="btn_task_search" type="button"
										onclick="commonStatInfo('task')" class="btn btn-ade-default">查询</button>
								</div>
							</div>
						</div>
					</div>
				</div>
				<div id="stat_shqc"><a id="a_shqc" title="条件显示"><<</a></div>
				<div id="stat_cdts" class="span12" style="display: none;">
					<table>
						<tr>
							<td id="expression_conditions">
								<div id="ec_div" class="div_search_result" style="margin-top: 17px;">
									<div id="shu" style="border:1px solid #CCC; min-height: 241px;">
									 	<div class="typeList">
											<ul id="tree" class="ztree" style="width:180px; margin-top:1px;"></ul>
										</div>
									</div>
								</div>
								
								<script type="text/javascript">
									var zNodes = eval('[$!{tree}]');
									function zTreeOnClick(event, treeId, treeNode) {
										if(treeNode.expression == "" || treeNode.expression == null){
											$("#groupName").val("");
											$("#expression").val("");
											$("#expressionType").val("");
										}else{
												var val = treeNode.text;
												var parent = treeNode.getParentNode();
												while(parent.text!="查询条件"){
											        val = parent.text +"-"+ val;
											        parent = parent.getParentNode();
												}
												$("#groupName").val(val);
												$("#expression").val(treeNode.expression);
											    $("#expressionType").val(treeNode.valueType);
										}
										//提示
										var type = treeNode.valueType;
										if (type == "int") {
											$("#proNameTint").text("请输入数字");
										} else if (type == "VARCHAR") {
											$("#proNameTint").text("请输入字符串");
										} else if (type == "DATETIME") {
											$("#proNameTint").text("格式：2014-01-01 12:12:12");
										} else if (type == "DATE") {
											$("#proNameTint").text("格式：2014-01-01");
										} else if (type == "TIME") {
											$("#proNameTint").text("格式：12:12:12");
										}
									}
									
									var setting = {
										view: {
											dblClickExpand: false,
											showLine: true,
											selectedMulti: false,
										},
										data :{
											key : {
												name:"text",
												children:"childNodes",
												url:"link"
											}
										},
									    callback: {
											onClick: zTreeOnClick
										} 
									};
								</script>
							</td>
					
							<td>
								<div class="panel" style="width: 860px !important; vertical-align: top;">
									<!-- 创建表达式区域start -->
									<div class="div_search_result">
										<input readonly type="text" class="form-control" name="name" id="groupName" style="width:200px; float:left; margin-top:6px;">
										<input id="expression" type="hidden">
										<input id="expressionType" type="hidden">
										<select id="resporId" name="resporId" style="float:left; margin-top:6px; margin-left:20px; width:80px;">
											<option value=""> </option>
											<option value=">">大于</option>
											<option value="<">小于</option>
											<option value="=">等于</option>
											<option value=">=">大于等于</option>
											<option value="<=">小于等于</option>
											<option value="<>">不等于</option>
											<option value="is null">为空</option>
											<option value="is not null">不为空</option>
											<option value="like">包含</option>
										</select>
										<input type="text" class="form-control" id="proName" style="width:200px; float:left; margin-top:6px; margin-left:20px;">
										<div id="proNameTint" style="float: left; height: 100%; margin-left: 5px; line-height: 40px; text-align: left;"></div>
										<button id="btn_member_export" type="button" class="btn btn-default panel-radius-all" style="margin-top:6px; margin-left:20px;">保存</button>
									</div>
									<div style="clear:both;"></div>
									<!-- 创建表达式区域end -->
									
									<!-- 表达式组合区域start -->
									<div class="div_search_result">
										<div class="panel-heading panel-result panel-result-title">
											<h3 class="panel-title">表达式</h3>
											<div class="btn-group btn-gp-default">
												<button id="ds_fit_meanwhile" type="button" class="btn btn-default panel-radius-left">同时满足</button>
												<button id="ds_fit_oneMore" type="button" class="btn btn-default panel-radius-none">满足其一</button>
												<button id="ds_fit_contrary" type="button" class="btn btn-default panel-radius-none">满足相反</button>
												<button id="ds_fit_delete" type="button" class="btn btn-default panel-radius-none">删除</button>
												<div class="btn-group">
													<button id="ds_fit_search" type="button" class="btn btn-default panel-radius-right">查询</button>
												</div>
											</div>
										</div>
										
										<table id="tb_stratety" class="table table-bordered table-hover table-condensed tb" style="text-align: center;">
											<tr>
												<td style="width: 30px;">
													<input name="ds_selectAll" type="checkbox">
												</td>
												<td style="width: 60px;">序号</td>
												<td>表达式</td>
											</tr>
										</table>
									</div>
									<!-- 表达式组合区域end -->
								</div>
							</td>
						</tr>
					</table>
				</div>
				
				<div id="stat_list" class="panel-radius-stat">
					<table class="table table-bordered table-hover table-condensed">
						
					</table>
				</div>
			</div>
		</div>
	</div>
</body>
<script type="text/javascript">
	
</script>
</html>